package resources;


public class Permissao {
	
	boolean[] line = new boolean[16]; //maximo de linhas possiveis
	int  n;
	int  sum;

	//int  run(int  k,int  x);
	public static void main(String[] args){
		Permissao permissao = new Permissao();
		permissao.begin();
	}
	

	public int begin()
	{
	        int  k,i,j;
	        int[]  D2 = new int [9];
	        D2[0] = 1;

	        for(i=1;i<9;i++){D2[i]=D2[i-1]*2;}
	        for(i=0;i<16;i++){line[i]=true;}

	        do
	        {
	                //scanf("%d%d",&n,&k);
	        		n = 4;
	        		k = 4;

	                if(n==0  &&  k==0){  break;}
	                else  if(n!=0  &&  k==0){  System.out.printf("1\n");}
	                else  if(k==1){  System.out.printf("%d\n",n*n);}
	                else  if(k>=2*n-1){  System.out.printf("0\n");}
	                else  if(k==2*n-2){  System.out.printf("%d\n",D2[n]);}
	                else
	                {
	                        int  total=0;
	                        int  temp=0;

	                        for  (int  p=0;p<k+1;p++)
	                        {
	                                sum=0;
	                                run(p,0);
	                                temp=sum;

	                                sum=0;
	                                run(k-p,1);

	                                total+=temp*sum;
	                        }

	                        System.out.printf("%d\n",total);
	                }
	        }while(true);

	        return  0;
	}

	int  run(int  k,int  x)
	{
	        if  (k==0){sum=1;      return  0;}

	        //22
	        if  (x>2*n-2){return  0;}

	        int  E = n - Math.abs(x-n+1); //   abs(x-n+1);


	        //22
	        for  (int  i=0;i<E;i++)
	        {
	                if  (line[n-1+E-2*i]==true)
	                {
	                        if  (k==1)//22
	                        {
	                                sum++;
	                        }
	                        else
	                        {
	                                line[n-1+E-2*i]=false;

	                                run(k-1,x+2);
	                                line[n-1+E-2*i]=true;
	                        }
	                }
	        }

	        //22
	        if((2*n-1)-x>k)
	        {
	                run(k,x+2);
	        }

	        return  0;
	}

	
}

